<?php

/**
 * 基类控制器
 */
namespace Core\Https;
use Core\Components\DBUtils;

class Controller
{
    protected $response;
    protected $code = 200;
    protected $msg = 'success';
    protected $db;
    public function __construct()
    {
        $this->response = new Response();
    }
    public function initDB($config)
    {
        $this->db = new DBUtils($config);
    }
    public function json($data = [])
    {
        $this->response->code = $this->code;
        $this->response->msg = $this->msg;
        return $this->response->json($data);
    }
    public function render($view)
    {
        require_once $view;
        return $this->response;
    }
}
